package DoublyLinked;

/**
 * Created by sunwei on 2017/10/11
 * Time:18:02
 */
public class DoublyLinkedApp {
    public static void main(String[] args) {
        DoublyLinked doublyLinked = new DoublyLinked();//实例化一个DoublyLinked对象
        doublyLinked.insertFirst(33);
        doublyLinked.insertFirst(44);
        System.out.println("从队列首端插入两个元素后，从前往后显示数据");
        doublyLinked.displayForward();
        System.out.println("从后往前显示数据");
        doublyLinked.displayBackward();

        doublyLinked.insertLast(55);
        doublyLinked.insertLast(66);
        System.out.println("从队列尾端插入数据，从前往后显示数据");
        doublyLinked.displayForward();
        System.out.println("从后往前显示数据");
        doublyLinked.displayBackward();

        System.out.println("从指定的元素后面插入数据 88 ");
        doublyLinked.insertAfter(33,88);
        System.out.println("插入后链表数据为");
        doublyLinked.displayForward();

        System.out.println("从链表的表头删除一个元素");
        doublyLinked.deleteFirst();
        doublyLinked.displayForward();

        System.out.println("从链表的表尾删除一个元素");
        doublyLinked.deleteLast();
        doublyLinked.displayForward();

        System.out.println("删除特定元素88");
        doublyLinked.deleteKey(88);
        doublyLinked.displayForward();


    }


}
